﻿using DotnetSpider.Scheduler.Component;
using Serilog;
using Serilog.Events;
using System;
using System.Threading.Tasks;
using DotnetSpider;

namespace CrawlerSpiderConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                           .MinimumLevel.Information()
                           .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Warning)
                           .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                           .MinimumLevel.Override("System", LogEventLevel.Warning)
                           .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Warning)
                           .Enrich.FromLogContext()
                           .WriteTo.Console().WriteTo.RollingFile("logs/spiders.log")
                           .CreateLogger(); 

            var builder = new SpiderHostBuilder()
                .Register<GithubSpider>() ;
            
             
            builder.Build().Start();

            Console.ReadKey();
            Environment.Exit(0);
        }
    }
}
